package com.rongji.dfish.ui.json;

import java.util.Collection;
import java.util.Stack;

/**
 * CollectionJsonBuilder 为java Collection用的转化器
 * @author DFish Team
 *
 */
public class CollectionJsonBuilder extends AbstractJsonBuilder {

	public void buildJson(Object o, StringBuilder sb,Stack<PathInfo> path,JsonBuilderParam jbp) {
		Collection<?> cast=(Collection<?>)o;
		boolean begin2=true;
		sb.append('[');
		for(Object item:cast){
			if(begin2)begin2=false;else sb.append(',');
			if(item==null){
				sb.append("null");
			}else{
				J.buildJson(item, sb,path,jbp);
			}
		}
		sb.append(']');
	}

}
